import { appTasks } from '@ohos/hvigor-ohos-plugin';
interface Plugin{
    apply(arg: any): void;
}
class PluginHelper {
    pluginId = "CustomPluginHelper"
    myPlugins:Plugin[] = []
    constructor(customPlugins:Plugin[]=[]) {
        this.myPlugins = [...customPlugins]
    }

    apply(arg: any) {
        // 这里能玩出什么花样呢
        console.log("自定义插件助手开始",process.env)
        this.myPlugins.forEach((plugin:Plugin) => {
            try {
                plugin.apply(arg);
            }catch(e){
                console.log("自定义插件助手异常",e)
            }
        })
    }
}


class Plugin1 implements Plugin {
    apply(arg: any) {
        console.log("Plugin1",arg)
    }
}


export default {
    system: appTasks,  /* Built-in plugin of Hvigor. It cannot be modified. */
    plugins:[new PluginHelper([new Plugin1()])]         /* Custom plugin to extend the functionality of Hvigor. */
}
